<html>
<head>
</head>
<body>
<?php
	session_set_cookie_params(60*60*24*365);
	session_start();

	if(isset($_GET['logout'])) {
		unset($_SESSION['userName']);
		header("Location: login.php");
	}

	if(isset($_POST['name'])) 
		$_SESSION['userName'] = $_POST['name'];

	if(isset($_SESSION['userName'])) {
		print("Al ingelogd als " .$_SESSION['userName']);
		print('<br><br><a href="?logout">Logout</a>');
	}else{
?>
	<form method="post">
	<label>Naam <input type="text" name="name" /></label>
	<input type="submit" value="Login">
	</form>
<?php
	}
?>
</body>
</html>

